Page({
  data: {
    countDown: 5 // 初始倒计时为 5
  },
  
  onLoad: function() {
    this.autoRedirect();
  },
  
  autoRedirect: function() {
    const timer = setInterval(() => {
      let countDown = this.data.countDown;
      countDown -= 1;
      if (countDown >= 0) {
        this.setData({
          countDown: countDown
        });
      } else {
        console.log(11112);
        wx.switchTab({
          url: '/pages/my/my'
        })
        clearInterval(timer); // 停止倒计时
      }
    }, 1000); 
  }
});